package cn.kgc.commons.vo;

import lombok.*;
import java.io.Serializable;

/**
 * vo 接收前端的参数 给前端返回值使用vo
 * dto service之间传递数据
 * entity 数据库表对应的实体类
 * pojo 一般用于封装数据
 */

@Setter
@Getter
@AllArgsConstructor
@NoArgsConstructor
@Builder
@SuppressWarnings("serial")
public class Result<T> implements Serializable {
    private int code;
    private String message;
    private T data;
    private String requestURL;

    public static<T> Result success(T date,String requestURL){
        return Result.builder().code(200).message("success").data(date).requestURL(requestURL).build();
    }

    public static<T> Result error(T date,String requestURL,int code,String message){
        return Result.builder().code(code).message(message).data(date).requestURL(requestURL).build();
    }
}
